home *** CD-ROM | disk | FTP | other *** search
/ Blackhawk for Windows 95 1996 November / Blackhawk for Windows 95 - Novermer 1996.iso / comm / q95demo.exe / SCRIPTS.Z / MAKEMCI3.QSC < prev   
Text File  |  1995-11-08  |  7KB  |  174 lines

  1. '
  2. ' This script is used to automatically create and add new dialing directory
  3. ' entry for MCI-Mail.
  4. '
  5. '--------------------------------------------------------=[ Constants    ]=-
  6. const WS_BORDER        = 0x00800000
  7. const WS_VSCROLL       = 0x00200000
  8. const WS_TABSTOP       = 0x00010000
  9. const LB_RESETCONTENT  = 0x0184
  10. const LB_GETTEXT       = 0x0189
  11. const LB_SETTABSTOPS   = 0x0192
  12. const LBS_NOTIFY       = 0x0001
  13. const LBS_SORT         = 0x0002
  14. const LBS_USETABSTOPS  = 0x0080
  15. const LBS_STANDARD     = LBS_NOTIFY+WS_BORDER+WS_VSCROLL+WS_TABSTOP
  16. const CB_GETLBTEXT     = 0x0148
  17. const CB_RESETCONTENT  = 0x014B
  18. const CBS_DROPDOWNLIST = 0x0003
  19. const CBS_SORT         = 0x0100
  20. const CBS_STANDARD     = CBS_DROPDOWNLIST+WS_VSCROLL+WS_TABSTOP
  21.  
  22. '---------------------------------------------------------------------------=[ Dialogs      ]=-
  23. dialog Generator 5, 10, 205, 240
  24.   caption "MCI Mail Script Maker"
  25.   groupbox "User Information", -1, 10, 10, 185, 55
  26.   rtext "Your User Name", -1, 15, 25, 50, 15
  27.   userid as edittext 101, 70, 25, 95, 15
  28.   rtext "Your Password", -1, 15, 45, 50, 15
  29.   password as edittext 102, 70, 45, 95, 15
  30.  
  31.   groupbox "Connection Information",-1,10,70,185,55
  32.   ltext "Modem",        -1, 15,85, 40, 15
  33.   modem as combobox    106, 60,85,130, 50,
  34.  
  35.   groupbox "Phone Information",-1, 10, 135, 185,75
  36.   pushbutton "Search Phone Database", 112, 100, 150, 90, 15
  37.   ltext "Phone Number", -1, 15,170, 70, 15
  38.   areacode as edittext 103,100,170, 25, 15
  39.   number as edittext   104,130,170, 60, 15
  40.   ltext "Country"  ,    -1, 15,190, 40, 15
  41.   country as combobox  105, 60,190,130, 50,CBS_STANDARD+CBS_SORT
  42.   
  43.   defpushbutton "Make Script", 114, 15, 220, 50, 14
  44.   pushbutton "Cancel", IDCANCEL, 75, 220, 50, 14
  45.   pushbutton "About/Info", 113, 135, 220, 50, 14
  46. end dialog
  47.  
  48. dialog ServicesHelp 6, 15, 194, 144
  49.   caption "About Script Generator"
  50.   defpushbutton "OK", IDOK, 72, 122, 50, 14
  51.   groupbox "", -1, 4, 4, 185, 111
  52.   ltext "MCI-Mail Script Generator is used to automatically create a script to call MCI-Mail.", -1, 10, 10, 170, 25
  53.   ltext "Macro Keys are also defined with common MCI-Mail Functions, Use the A,AC,AS,ASC button to toggle.", -1, 10, 35, 170, 25
  54.   ltext "Fill in User Name, Password, Country Code, and Modem.", -1, 10, 60, 170, 25
  55. end dialog
  56.  
  57. '--------------------------------------------------------=[ Declarations ]=---
  58. declare Sub SendDlgItemMessageText lib "user32" alias "SendDlgItemMessageA" (hwnd as integer, id as integer, message as integer, wparam as integer, lparam as string)
  59. declare function SendDlgItemMessageInt  lib "user32" alias "SendDlgItemMessageA" (hwnd as integer, id as integer, message as integer, wparam as integer, lparam as long) as long
  60. declare function GetDlgItem lib "user32" (hwindow as integer, id as integer) as integer
  61. declare function EnableWindow lib "user32" (hwindow as integer, on as integer) as integer
  62.  
  63. '---------------------------------------------------------------------------=[ Variables    ]=-
  64. dim n as string
  65. dim sl as Generator                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  66. dim count as integer
  67. dim scriptname as string
  68. dim cinfo as countryinfo
  69. dim readstring as string
  70.  
  71. '---------------------------------------------------------------------------=[ Functions    ]=-
  72. function GetUniqueScriptName(prefix as string) as string
  73.   dim scrname as string
  74.   scrname = ConfigScriptPath + "\" + prefix + ".QSC"
  75.   dim i as integer
  76.   i = 0
  77.   do while exists(scrname)
  78.     i = i + 1
  79.     scrname = ConfigScriptPath + "\" + prefix + str(i) + ".QSC"
  80.   loop
  81.   GetUniqueScriptName = scrname
  82. end function
  83.  
  84. function Generator.id(113) as integer
  85.   dim help as ServicesHelp
  86.   dialogbox help
  87. end function
  88.  
  89. function Generator.id(114) as integer
  90.   if userid = "" then
  91.     msgbox "You need to fill in your User Name."
  92.     exit function
  93.   end if
  94.  
  95.   if password = "" then
  96.     msgbox "You need to fill in your password."
  97.     exit function
  98.   end if
  99.  
  100.   if (country < 0) then
  101.     msgbox "You need to pick a country."
  102.     exit function
  103.   end if
  104.  
  105.   DialogResult = IDOK
  106.   n = spc(255)
  107.   SendDlgItemMessageText (hwindow,105,CB_GETLBTEXT,sl.country,n)
  108. end function
  109.  
  110. '---------------------------------------------------------------------------=[ Subroutines  ]=-
  111. sub Generator.init
  112.   enablewindow (getdlgitem (hwindow,112),0)
  113.   enablewindow (getdlgitem (hwindow,103),0)
  114.   enablewindow (getdlgitem (hwindow,104),0)
  115.   areacode = "800"
  116.   number = "967-9600"
  117.   userid   = ""
  118.   password = ""
  119.   for count = 1 to getmodemcount
  120.     addcomboboxitem (hwindow,106,getmodemname (count - 1))
  121.   next count
  122.   modem = 0
  123.   if getfirstcountry (cinfo) then
  124.     do
  125.       readstring = pad (cinfo.name,150)+pad(str(cinfo.countryid),5)+pad(str(cinfo.countrycode),5)
  126.       addcomboboxitem (hwindow,105,readstring)
  127.     loop until not (getnextcountry (cinfo))
  128.   end if
  129. end sub
  130.  
  131. sub CreateMCIScript
  132.   print #1, "striphibit on"
  133.   print #1, "waitfor ""your user name:"""
  134.   print #1, "send lastconnectuserid"
  135.   print #1, "waitfor ""Password:"""
  136.   print #1, "send lastconnectpassword"
  137. end sub
  138.  
  139. '---------------------------------------------------------------------------=[ Main         ]=-
  140. MAIN:
  141.  
  142. if dialogbox(sl) = IDOK then
  143.   scriptname = GetUniqueScriptName("mci")
  144.   open scriptname for output as #1
  145.   CreateMCIScript
  146.   close #1
  147.   dim entry as phoneentry
  148.   entry.name = "MCI Mail"
  149.   entry.areacode = sl.areacode
  150.   entry.number(1) = sl.number
  151.   entry.userid = sl.userid
  152.   entry.password = sl.password
  153.   entry.scriptfile = scriptname
  154.   entry.macrofile = "mcimail.mac"
  155.   entry.emulation = ansi
  156.   entry.protocol = zmodem
  157.   entry.useareacountry = 1
  158.   entry.tapidevice = getmodemname (sl.modem)
  159.   entry.countryid   = val(mid(n,151,5))
  160.   entry.countrycode = val(mid(n,156,5))
  161.   entry.iconrespath = "bbsicons.dll"
  162.   entry.iconresid = 4
  163.   if updatephoneentry (entry) then
  164.     msgbox ("MCI-Mail Entry Modified With New Information")
  165.   else
  166.     addphoneentry (entry)
  167.     msgbox ("Phone directory entry for MCI-Mail created.")
  168.   end if
  169. end if
  170.  
  171. catch err_fileopen
  172.   msgbox "Could not create script: " + scriptname
  173.   goto main
  174.